<?php
/**
 * Created by PhpStorm.
 * User: adophper <hello@adophper.com>
 * Date: 2018/3/20
 * Time: 11:12
 */
?>

<!--页脚部分-->
<div class="<?=Yii::$app->controller->id == 'member'?'':'footAre'?>">
    <div class="footBox_top">
        <div class="footBox_top_foot flex">
            <?= \frontend\widgets\LinkMenu::widget()?>
        </div>
    </div>
    <div class="footBox_foot">
        <div class="footBox_foot_box flex f_between f_relative">
            <ol class="footBox_foot_box_left fbox">
                <li class="fl"><?=Yii::$app->system->copyright()?></li>
                <li class="fl">ICP证：<?=Yii::$app->system->icp()?></li>
            </ol>
            <div class="footBox_foot_box_right flex f_relative">
                <label>分享到：</label>
                <ol class="fbox">
                    <li class="fl iconfont" onclick="shareTo('sina')">&#xe62f;</li>
                    <li class="fl iconfont" onclick="shareTo('wechat')">&#xe611;</li>
                    <li class="fl iconfont" onclick="shareTo('qzone')">&#xe619;</li>
                    <li class="fl iconfont" onclick="shareTo('qqweb')">&#xe63d;</li>
                </ol>
            </div>
            <div class="footBox_foot_box_right_tab fbox">
                <span class="fl btn_red"><a href="javascript:scrollTo(0,0);" style="text-decoration:none;color: #fff">TOP</a></span>
                <span class="fl"><a href="/" style="text-decoration:none;color: #fff">返回首页</a></span>
            </div>
        </div>
    </div>
</div>
<!--定位浮层-->
<div class="fixeMark">
    <ol class="fmark_tab">
        <li>
            <span class="flex f_center"><i class="white">VR</i></span>
            <em>VR展示</em>
        </li>
        <li>
			<span class="flex f_center"><i class="iconfont large">&#xe77e;</i></span>
            <em>视频直播</em>
        </li>
        <li>
			<span class="flex f_center"><i class="iconfont">&#xe61d;</i></span>
            <em><a href="<?=Yii::$app->urlManager->createUrl(['contact/index']) ?>" style="text-decoration:none;color: #fff">联系我们</a></em>
        </li>
        <li class="rightGoToTop red" style="display: none;">
            <span class="flex f_center"><i class="iconfont large"><a href="javascript:scrollTo(0,0);" style="text-decoration:none;color: #fff">&#xe613;</a></i></span>
        </li>
    </ol>
</div>
<script>
    $(window).scroll(function () {
        var scrollTop = $(window).scrollTop();
        if (scrollTop > 10) {
            $(".rightGoToTop").show();
            $(".fixeMark").addClass('enable');
        }else{
            $(".rightGoToTop").hide();
            $(".fixeMark").removeClass('enable');
        }
    })
    //一键分享
    function shareTo(stype){
        var ftit = '';
        var flink = '';
        var lk = '';
        ftit = $('.pctitle').text();
        flink = $('.pcdetails img').eq(0).attr('src');
        if(typeof flink == 'undefined'){
            flink='';
        }

        if(flink == ''){
            lk = 'http://'+window.location.host+'/static/images/logo.png';
        }
        if(flink.indexOf('/uploads/') != -1) {
            lk = 'http://'+window.location.host+flink;
        }
        if(flink.indexOf('ueditor') != -1){
            lk = flink;
        }

        if(stype=='qzone'){
            window.open('https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+document.location.href+'?sharesource=qzone&title='+ftit+'&pics='+lk+'&summary='+document.querySelector('meta[name="description"]').getAttribute('content'));
        }
        if(stype=='sina'){
            window.open('http://service.weibo.com/share/share.php?url='+document.location.href+'?sharesource=weibo&title='+ftit+'&pic='+lk+'&appkey=2706825840');
        }
        if(stype == 'qq'){
            window.open('http://connect.qq.com/widget/shareqq/index.html?url='+document.location.href+'?sharesource=qzone&title='+ftit+'&pics='+lk+'&summary='+document.querySelector('meta[name="description"]').getAttribute('content')+'&desc=sadasdas');
        }
        if(stype == 'qqweb'){
            window.open('http://share.v.t.qq.com/index.php?c=share&a=index&url='+document.location.href+'&title='+ftit+'&pic='+lk+'&site='+document.location.href+'&appkey=5bd32d6f1dff4725ba40338b233ff155');
        }
        if(stype == 'wechat'){
            window.open('inc/qrcode_img.php?url='+document.location.href);
        }

    }

    //订阅
    $('#subscribe').click(function () {
        var email = $('#subscribe-email').val();
        var re = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        var _csrf = $('#_csrf').val();
        if (!re.test(email)){
            alert('请输入正确的邮箱格式');
            return false;
        }
        $.post("<?=Yii::$app->urlManager->createUrl(['home/subscribe'])?>", {_csrf:_csrf,email: email}, function(data){

            if(data.code == 0){
                alert("订阅成功");
            }else {
                alert("订阅失败");
            }
        });
    })
</script>
